﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;

namespace IHISCETeim.Web.MachineSys.UserModel
{
    public partial class U4008RecordReplayList : PageBase
    {
        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] {Permission.修改 };
            }
        }
        protected override string DWZRef
        {
            get
            {
                return "U4008RecordReplayList";
            }
        }
        #region 属性 (查询条件)



        protected string CustomerName
        {
            get
            {
                return GetRequestValue<string>("CustomerName", "");

            }
        }
        protected string SerialNumber
        {
            get
            {
                return GetRequestValue<string>("SerialNumber", "");

            }
        }

        protected string AgentName
        {
            get
            {
                return GetRequestValue<string>("AgentName", "");

            }
        }



        protected bool ShowTimeInput
        {
            get
            {
                return GetRequestValue<bool>("ShowTimeInput", true);
            }
        }
        protected string CallDateFrom
        {
            get
            {
                return ShowTimeInput ? "" : GetRequestValue<string>("CallDateFrom", "");
            }
        }

        protected string CallDateTo
        {
            get
            {
                string _temp = ShowTimeInput ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : GetRequestValue<string>("CallDateTo", "");

                return CallDateFrom.IsEmptyOrNull() ? "" : _temp.IsEmptyOrNull() ? Convert.ToDateTime(CallDateFrom).AddDays(1).ToString("yyyy-MM-dd") : _temp;

                //  return _temp.IsEmptyOrNull() ? CreateDateFrom.IsEmptyOrNull() ? "" : Convert.ToDateTime(CreateDateFrom).AddDays(1).ToString("yyyy-MM-dd") :  CreateDateFrom.IsEmptyOrNull()?"":_temp;
            }
        }

        protected int IsComplete
        {
            get
            {
                return GetRequestValue<int>("IsComplete", -1);
            }
        }

        protected string RealName
        {
            get
            {
                return base.User.RealName;
            }
        }

        protected override string orderField
        {
            get
            {
                return GetRequestValue<string>("orderfield", "IsComplete");
            }
        }

        protected override string orderDirection
        {
            get
            {
                return GetRequestValue<string>("orderDirection", "asc");
            }
        }
        #endregion

        protected void Page_Load(object sender, EventArgs e)
        {
            DataBind();
            this.AddLog(Permission.查看);
        }

        protected void DataBind()
        {
            //  string wheresql = QueryOperatorsEnumHelper.ConvertCommonOperator(CommonFiled, QueryOperatorsEnum.包含, CommonValue);

            this.rpMenu.DataSource = U4008RecordController.GetPagination("", RealName, SerialNumber, CustomerName, AgentName,IsComplete,CallDateFrom, CallDateTo, pageNum, numPerPage, SQLSort, ref TotalCount);
            this.rpMenu.DataBind();
        }
    }
}